package com.hongyun.tms.common.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import com.hongyun.tms.common.annotation.Dict;
import com.hongyun.tms.common.annotation.Translate;
import com.hongyun.tms.common.constants.TranslateAnnotationConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author liPeng
 * @date 2024-05-31
 **/
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
public class CrewCertVO implements Serializable {
    @ApiModelProperty(value = "主键")
    private Long id;


    @ApiModelProperty(value = "证书名称")
    private String certName;

    @ApiModelProperty(value = "船员ID")
    @Translate(tableName = TranslateAnnotationConstant.TABLE_STAFF, fieldName = "crewName")
    private Long crewId;


    @ApiModelProperty(value = "证书种类ID")
    @Dict(code = "CREW_CERTIFICATE", fieldName = "certTypeName")
    private String certTypeId;

    @ApiModelProperty(value = "证书有效期起")
    private LocalDate beginDate;

    @ApiModelProperty(value = "证书有效期止")
    private LocalDate endDate;

    @ApiModelProperty(value = "是否过期，endDate >= today时，设置为1已过期，否则0")
    private Integer expireFlag;

    @ApiModelProperty(value = "证书编号")
    private String certNo;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    private List<Attach> attachList = Lists.newArrayList();

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder(toBuilder = true)
    public static class Attach {
        private String url;
        private String fileId;
        private String businessType;
    }
}

